class code2 {
    //双指针： 缩减搜索空间
    public int[] twoSum(int[] numbers, int target) {
        int l = 0;
        int r = numbers.length-1;
        while(l < r) {
            int sum = numbers[l] + numbers[r];
            if(sum < target) {
                l++;
            } else if(sum > target){
                r--;
            } else {
                return new int[]{l+1,r+1};
            }
        }
        return new int[]{0,0};
    }
}